<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class page2_model extends Model
{
	function page2_model()
	{
		parent::Model();
	}
	
	function admin_id()
	{
		global $CI;
		$a = $CI->session->userdata('admin_auth_logged');
		return $a['admin_id'];
	}
	
	function blocks_in_column($pid, $col)
	{
		$this->db->order_by(CELL_LINK_ORDER_ID);
		$q = $this->db->get_where(CELL_LINK, array(CELL_LINK_FRANCHISE_ID=>$this->admin_id(), CELL_LINK_PAGE_ID=>$pid, CELL_LINK_COL_ID=>$col));
		return $q->result();
	}
	
	function limit_blocks_in_column($pid, $col)
	{
		$this->db->select_max(CELL_LINK_ORDER_ID);
		$q = $this->db->get_where(CELL_LINK, array(CELL_LINK_FRANCHISE_ID=>$this->admin_id(), CELL_LINK_PAGE_ID=>$pid, CELL_LINK_COL_ID=>$col));
		$row = $q->row();
		return $row?$row->{CELL_LINK_ORDER_ID}:5;
	}
}

?>
